<%-- 
    Document   : BankDetail
    Created on : 16/Jan/2010, 11:54:28
    Author     : mario
--%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${requestScope['title']} - ${requestScope['action']}</title>
    </head>
    <body>
        <h1>${requestScope['title']} - ${requestScope['action']}</h1>
        <form action="?action=${requestScope['formMethod']}" method="POST">
            <c:choose>
                <c:when test="${!empty requestScope['instance']}">
                    <input type="hidden" name="id" value="${requestScope['instance'].id}" />
                </c:when>
            </c:choose>
            <table>
                <tbody>
                    <tr>
                        <td>Nome :</td>
                        <td><input type="text" name="name" value="${requestScope['instance'].name}" maxlength="40" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Abreviatura :</td>
                        <td><input type="text" name="shortName" value="${requestScope['instance'].shortName}" maxlength="9" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Codigo :</td>
                        <td><input type="text" name="code" value="${requestScope['instance'].code}" maxlength="4" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Morada :</td>
                        <td><input type="text" name="address" value="${requestScope['instance'].address}" maxlength="40" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Telefone :</td>
                        <td><input type="text" name="phone" value="${requestScope['instance'].phone}" maxlength="9" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Responsavel :</td>
                        <td><input type="text" name="responsibleName" value="${requestScope['instance'].responsibleName}" maxlength="40" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Email do responsavel :</td>
                        <td><input type="text" name="responsibleEmail" value="${requestScope['instance'].responsibleEmail}" maxlength="40" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Servidor :</td>
                        <td><input type="text" name="hostName" value="${requestScope['instance'].hostName}" maxlength="15" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Porta do servidor :</td>
                        <td><input type="text" name="serviceLocation" value="${requestScope['instance'].hostPort}" maxlength="15" ${requestScope['editable']} /></td>
                    </tr>
                    <tr>
                        <td>Estado do banco :</td>
                        <c:choose>
                            <c:when test="${requestScope['bankStatus'] == 'register'}">
                                <td><input type="button" value="Desactivar" onclick="this.form.action='?action=unregister'; this.form.submit();"/></td>
                            </c:when>
                            <c:otherwise>
                                <td><input type="button" value="Activar" onclick="this.form.action='?action=register'; this.form.submit();"/></td>
                            </c:otherwise>
                       </c:choose>
                    </tr>
                    <tr>
                        <c:choose>
                            <c:when test="${requestScope['formMethod'] == 'save' || requestScope['formMethod'] == 'update'}">
                                <td><input type="submit" value="Gravar" /></td>
                                    <c:choose>
                                        <c:when test="${requestScope['formMethod'] == 'update'}">
                                        <td><input type="button" value="Cancelar" onclick="this.form.action='?action=detail'; this.form.submit();"/></td>
                                        </c:when>
                                        <c:otherwise>
                                        <td><input type="button" value="Cancelar" onclick="this.form.action='?'; this.form.submit();"/></td>
                                        </c:otherwise>
                                    </c:choose>
                                </c:when>
                                <c:otherwise>
                                <td><input type="button" value="Editar" onclick="this.form.action='?action=edit'; this.form.submit();"/></td>
                                <td><input type="button" value="Voltar" onclick="this.form.action='?'; this.form.submit();"/></td>
                                </c:otherwise>
                            </c:choose>

                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>

